package com.cloudbroker.bcs.common.service.base;

import java.util.List;

import com.cloudbroker.bcs.common.entity.Pageable;
import com.cloudbroker.bcs.common.model.Pagination;
import com.cloudbroker.bcs.common.model.SortMarker;

public interface ServiceBase<T extends Pageable, K> {
    
    public void save(T entity);
    
    public T get(K key);
    
    public Integer count(T example);
    
    public List<T> query(T example);
    
    public List<T> queryAll();
    
    public List<T> queryWithPagination(T example, Pagination page);
    
    public List<T> queryWithPagination(T example, Pagination page, SortMarker... sortMarkers);
    
    public int update(T entity);
    
    public int updateCAS(T entity);
    
    public int updateCAS(T entity, boolean throwException);
    
    public int delete(K key);

    public int deleteByEntity(T entity);

    public T getByEntity(T entity);
    
}
